<?php
/**
 * Created by PhpStorm.
 * User: sunshine
 * Date: 2016/8/30
 * Time: 20:01
 */
require_once ('Admin/View/template/inc_admin.php');
?>

<div class="col-md-10  col-xs-12 col-sm-10 col-sm-offset-1 col-md-offset-1 col-xs-offset-1"  style="position: relative;top: 50px;"  >
    <h2 style="color: #03c2f9; margin-bottom: 0px;padding-bottom: 0px;"><p class="bg-white" style="margin-bottom: 10px;margin-top: 10px" >试题类别列表</p></h2>
    <h4><p class="bg-info" style="margin-top:0px ;padding:10px" ><a href="admin.php" style="color: white">首页&nbsp;</a>/&nbsp;试题类别列表</p></h4>
</div>

<div class="container-fluid control-label  col-md-12 ">
    <table class="table table-hover" style="width: 600px;margin-left: 20%;margin-top:150px; color: #0a0a0a;font-size: 20px;font-family: 微软雅黑">
        <tr  class="danger">
            <th  style="padding-left: 50px;background-color: #eee;">类别号</th>
            <th style="padding-left: 50px;background-color: #eee;">类别名</th>
            <th style="padding-left: 50px;background-color: #eee;">操作</th>
        </tr>
        <?php
        foreach ($data['type'] as $row) {
            if (is_array($row)) {
                echo ' <tr class="success"  >';
                echo '<td style="padding-left: 60px">' . $row['typeid'] . '</td>';
                echo '<td style="padding-left: 60px">' . $row['typename'] . '</td>';
                echo '<td><button class="btn btn-info" style="font-family: 微软雅黑;margin-top:10px; padding-left:11px; background-color:#90EE90;width:50px;height:30px"><a style="color:black;" href="admin.php?c=type&m=mod&id=' . $row['typeid'] . ' ">修改</a></button>
	 <button class="btn btn-danger" style="font-family: 微软雅黑;margin-top:10px;padding-left:11px; background-color:#E9967A;width:50px;height:30px"><a style="color:black;" href="admin.php?c=type&m=del&id=' . $row['typeid'] . '" onClick="return confirm(\'确定要删除吗？\');">删除</a></button></td>';
                echo '</tr>';
            }
            else{
                $totalrows=1;
                echo ' <tr class="success"  >';
                echo '<td style="padding-left: 60px">' . $data['type']['typeid'] . '</td>';
                echo '<td style="padding-left: 60px">' . $data['type']['typename'] . '</td>';
                echo '<td><button class="btn btn-info" style="font-family: 微软雅黑;margin-top:10px; padding-left:11px; background-color:#90EE90;width:50px;height:30px"><a style="color:black;" href="admin.php?c=type&m=mod&id=' . $data['type']['typeid'] . ' ">修改</a></button>
	 <button class="btn btn-danger" style="font-family: 微软雅黑;margin-top:10px;padding-left:11px; background-color:#E9967A;width:50px;height:30px"><a style="color:black;" href="admin.php?c=type&m=del&id=' . $data['type']['typeid'] . '" onClick="return confirm(\'确定要删除吗？\');">删除</a></button></td>';
                echo '</tr>';
                break;
            }
        }
        echo '</table>';
        if($totalrows!=1)
        $totalrows = count($data['type']);
        echo '<h2 style="font-family:微软雅黑;text-align:right;color:red;position:relative;right:200px;top: -50px;">共有'.$totalrows.'门学科</h2>';
        ?>
        <div style="margin-left: 950px;margin-top: -400px">
            <img src="assets/img/试题3.jpg" width="240px" height="240px"  alt="">
        </div>
</div>

</body>
</html>
